import Vue from 'vue';

import { Row, Col, Button, Select, Option, OptionGroup, Form, Rate, FormItem, Input, Checkbox, CheckboxGroup, BreadcrumbItem, Breadcrumb, Radio, RadioGroup, Upload, Message, Loading, Autocomplete, Steps, Step, MessageBox, Dialog, Cascader, Pagination, DatePicker, TimePicker, Switch, Table, TableColumn } from 'element-ui';
import md5 from 'md5';
import { stringify } from 'querystring';

import http from '@/utils/http';
import ls from '@/utils/localStorage';
import UserHeader from '@/components/modules/AccountHeader';


// element-ui 按需加载
Vue.use(Row);
Vue.use(Col);
Vue.use(Button);
Vue.use(Select);
Vue.use(Option);
Vue.use(OptionGroup);
Vue.use(Form);
Vue.use(Rate);
Vue.use(FormItem);
Vue.use(Input);
Vue.use(Checkbox);
Vue.use(CheckboxGroup);
Vue.use(Breadcrumb);
Vue.use(BreadcrumbItem);
Vue.use(Radio);
Vue.use(RadioGroup);
Vue.use(Upload);
Vue.use(Loading);
Vue.use(Autocomplete);
Vue.use(Steps);
Vue.use(Step);
Vue.use(Dialog);
Vue.use(Cascader);
Vue.use(Pagination);
Vue.use(DatePicker);
Vue.use(TimePicker);
Vue.use(Switch);
Vue.use(Table);
Vue.use(TableColumn);


// 本地localStorage储存
Vue.use(ls);

/*
这样可以在组件方法里 通过this.xxx 来调用
*/
// axios实例
Vue.prototype.$http = http;
// md5加密
Vue.prototype.$md5 = md5;
// 对象转字符串
Vue.prototype.$stringify = stringify;
Vue.prototype.$msgbox = MessageBox;
// Vue.prototype.$alert = MessageBox.alert;
Vue.prototype.$confirm = MessageBox.confirm;
Vue.prototype.$prompt = MessageBox.prompt;
Vue.prototype.$message = Message;
Vue.prototype.$loading = Loading.service;

/*
全局标签注册 通过this.xxx 来调用
*/
// 公共头底
Vue.component('account-header', UserHeader);

export default Vue;
